<template>
  <view class="listWrapper" :style="{
                padding:'0px ' + properties.setStyle.pageMargin+'px',
                'margin': properties.setStyle.pageMarginTop+'px '+' 0px',
              }">
    <view class="order-card" :style="{
                'border-radius': properties.setStyle.borderRadiusLeftTop+'px ' +  properties.setStyle.borderRadiusRightTop+'px '+  properties.setStyle.borderRadiusLeftBottom+'px '+  properties.setStyle.borderRadiusRightBottom+'px ',
                'background-color': properties.setStyle.backgroundColor,
                'padding': properties.setStyle.panddingTopBootom+'px ' + properties.setStyle.panddingLeftRight+'px ',
              }">
      <view class="head-title">
        <view class="userInfo" v-if="isLogin">
          <view style="display: flex;align-items: center">
            <view>
              <uv-avatar mode="aspectFill" size="30" :src="userInfo.avatar"></uv-avatar>
            </view>
            <view style="margin-left: 10px">
              <uv-text :color="properties.setStyle.textColor" :size="properties.setStyle.textSize" :text="'Hey,同学您好！'"></uv-text>
            </view>
          </view>
          <view>
            <uv-text :color="properties.setStyle.textColor" :size="properties.setStyle.textSize"
                     :text="(userInfo.schoolInfo!==undefined && userInfo.schoolInfo!==null)?userInfo.schoolInfo.schoolName:'尚未绑定学校'"></uv-text>
          </view>
        </view>

        <view class="userInfo" v-else>
          <view style="display: flex;align-items: center">
            <view style="margin-left: 10px">
              <uv-avatar mode="aspectFill" size="30"
                         src="/static/images/anon_nan.png"></uv-avatar>
            </view>
            <view style="margin-left: 10px">
              <uv-text :color="properties.setStyle.textColor" :size="properties.setStyle.textSize" :text="'Hey,同学您好！'"></uv-text>
            </view>
          </view>
          <view>
            <uv-text :color="properties.setStyle.textColor" :size="properties.setStyle.textSize" text="未选择学校"></uv-text>
          </view>
        </view>

        <view @click="goDetail(properties.setStyle)" class=""
              style="display: flex;margin-top: 5px;align-items: center;justify-content: space-between">
          <view style="display: flex;align-items: center;margin-right: 20rpx">
            <view
                :style="{'background':properties.setStyle.runnerTextLabelColor+'','height':'9px','width':'3px','margin-right':'3px'}"></view>
            <view
                :style="{'font-weight': 'bolder',color:properties.setStyle.runnerTextLabelColor,'font-size':properties.setStyle.runnerTextLabelSize}">
              {{ properties.setStyle.runnerTextLabelName }}
            </view>
          </view>
          <view :style="{'color':properties.setStyle.runnerTextColor,'font-size':properties.setStyle.runnerTextSize+'px'}">
            {{ properties.setStyle.runnerTextCenter }}
          </view>

          <view class="runnerText" @click="goDetail(properties.setStyle)"
                :style="{display: 'flex','align-items': 'center','color':properties.setStyle.runnerTextColor,'font-size':properties.setStyle.runnerTextSize+'px'}">
            {{ properties.setStyle.runnerTextRight }}
            <uv-icon :color="properties.setStyle.runnerTextColor" style="margin-left: 5rpx" name="arrow-right" size="10"/>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
import Dict from '@/components/school/dict';
import {mapGetters} from "vuex";
import diyJson from '@/config/diy.js';

const app = getApp();
// 分割线
export default {
  computed: mapGetters(['schoolId']),
  components: {
    Dict
  },
  data() {
    return {
      themConfig: diyJson.commonStyle,
      localDatas: this.datas,
      riderState: 0
    }
  },
  name: "IndexUser",
  props: {
    commonStyle: {
      type: Object,
      default() {
        return {
          /* crmeb颜色变量 */
          theme: {
            color: "#cb6025",
          },
          font: {
            color: "#282828", // 常规字体颜色
            activeColor: "#E93323", // 字体激活颜色 和主题色一至
          },
        };
      }
    },
    properties: {
      type: Object,
      default: function () {
        return {
          "setStyle": {
            'borderRadius': 10,
            'backgroundColor': 'white',
            "pageMargin": 10,
            "padding": 10
          }
        }
      }
    },
    userInfo:{
      type:Object,
      default: function () {
        return {}
      }
    },
    isLogin:{
      type:Boolean,
      default: function () {
        return false
      }
    }

  },
  watch: {},
  methods: {

    goDetail(item) {
      uni.navigateTo({
        url: item.runnerTextLink
      });
    },

  },
  created() {
    // if (this.uid) {
    //   console.log("created check login ",this.userInfo)
    //       this.isLogin = true;
    // }
  },
  onShow(){
    // if (this.uid) {
    //   console.log("created check login ",this.userInfo)
    //   this.isLogin = true;
    // }
  }
}
</script>

<style scoped lang="scss">
.userInfo {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}

.runnerText {
}

</style>
